$(function() {
	 $('#getemp').combobox({
		url:'../check/getemp',
		valueField:'empId',
		textField:'empId',
		panelHeight:'auto'
		});
	
		$('#holidayType').combobox({
		url:'../check/getcheckAffairCategory2',
		valueField:'affairId',
		textField:'affairName',
		panelHeight:'auto'
		});	
})

function clear(){
	$('#ff').form('clear');
}
function save(){
	var applyId=$("#applyId").val();
	var getemp=$("#getemp").val();
	var holidayType=$('#holidayType').combobox("getText");
	var reason=$("#reason").val();
	var beginTime=$("#beginTime").val();
	var endTime=$("#endTime").val();
	var applys = [];
	if(apply==null||applyId===''){
	var maker='huohuo';
	var apply = {
			getemp : getemp,
			holidayType : holidayType,
			reason : reason,
			beginTime : beginTime,
			endTime : endTime,
			maker:maker
		};
	    applys.push(apply);
		var jsondata = JSON.stringify(applys);
	$.ajax({
		url : "../check/addAffairApply",
		data : {"jsondata" : jsondata},
		success : function(e) {
			if (e == "ok") {
				alert("存储成功");
               $('#huodg5').datagrid('load');
			}
		}
	});
	}else{
		var maker=$("#maker").val();
		var apply = {
				applyId : applyId,
				getemp : getemp,
				holidayType : holidayType,
				reason : reason,
				beginTime : beginTime,
				endTime : endTime,
				maker : maker
			};
		    applys.push(apply);
			var jsondata = JSON.stringify(applys);
		$.ajax({
			url : "../check/updateAffairApply",
			data : {"jsondata" : jsondata},
			success : function(e) {
				if (e == "ok") {
					alert("存储成功");
	               $('#huodg5').datagrid('load');
				}
			}
		});
	}
}
$('#fb').filebox({
    buttonText: '选择文件'
});
$("#huo_save").linkbutton();
$("#huo_save").bind('click',function(){
	$("#upload").submit();
});
$("#upload").form({
	 	url:"../up/upload",
	    onSubmit: function(){
			return true;
	    },
	    success:function(data){
	    	alert("图片提交成功");
	    }
});
